package com.project.genesis.admin.listener;

import com.alibaba.fastjson.JSONObject;
import com.project.genesis.common.constant.RabbitMQEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.Date;

/**
 * @author xnd
 * 首页-消息中心提醒
 * 用户管理端提醒护士,哪些患者是出院满三个月的
 * @since 2023/8/2 16:59
 */
@Component
@Slf4j
public class MsgCenterConsumer {

//    @Resource
//  private MessageCenterService messageCenterService;
//    // 监听消息
//    @RabbitListener(queues = RabbitMQEnum.MESSAGE_CENTER_QUEUE)
//    public void  receiveMessageCenterQueue(Message message){
//        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
//        log.info("消费者收到消息中心信息:{},{}",msg,new Date());
//        List<MessageCenter> messageCenter = JSONObject.parseArray(msg, MessageCenter.class);
//        messageCenterService.saveOrUpdateBatch(messageCenter);
//    }
}
